<?php
/**
 * Created by PhpStorm.
 * User: Administrator
 * Date: 2016/8/23
 * Time: 11:31
 */

use yii\widgets\ActiveForm;
?>

<?php $form = ActiveForm::begin(['enableAjaxValidation' => true, 'enableClientValidation' => false,'options'=>['class'=>'form-validate']]); ?>
<div class="yx-clear">
    <label class="zx-label" style="width: 20% !important"><?= $model->attributeLabels()['status']; ?></label>
    <div class="zx-field-floatl" style="width: 70% !important; line-height: 30px">
        <?= $form->field($model,'status',['template' => '{input}{error}{hint}'])->radioList([1=>'审核中',2=>'成功',3=>'未通过'])?>
    </div>
</div>
<div class="yx-clear">
    <label class="zx-label" style="width: 20% !important"><?= $model->attributeLabels()['dues_proportion']; ?></label>
    <div class="zx-field-floatl" style="width: 70% !important; line-height: 30px">
        <?php if(\Yii::$app->user->identity->role=='mechanic') $disabled =true;else $disabled=false;?>
        <?= $form->field($model, 'dues_proportion', ['template' => '{input}{error}{hint}'])->textInput(['style' => 'width:180px','class' => 'input-text','disabled'=>$disabled])->hint('如优惠50% 填写50') ?>
    </div>
</div>
<div class="yx-clear">
    <label class="zx-label" style="width: 20% !important"><?= $model->attributeLabels()['remarks']; ?></label>
    <div class="zx-field-floatl" style="width: 70% !important; line-height: 30px">
        <?= $form->field($model, 'remarks', ['template' => '{input}{error}{hint}'])->textarea(['rows' => 2, 'style' => 'width:400px;height:170px', 'class' => 'input-textarea','readonly'=>"readonly"]) ?>
    </div>
</div>
<div class="yx-clear">
    <label class="zx-label" style="width: 20% !important"><?= $model->attributeLabels()['new_remark']; ?></label>
    <div class="zx-field-floatl" style="width: 70% !important; line-height: 30px">
        <?= $form->field($model, 'new_remark', ['template' => '{input}{error}{hint}'])->textarea(['rows' => 2, 'style' => 'width:400px;height:80px', 'class' => 'input-textarea']) ?>
    </div>
</div>
<div style="display: none">
<?=\yii\helpers\Html::submitButton('提交', ['id'=>'dosubmit'])?>
</div>
<div id="role" data-role="<?=\Yii::$app->user->identity->role?>" style="display: none"></div>
<?php ActiveForm::end();?>
<?php
$js=<<<JS
    var role = $('#role').data('role');
    if(role === 'mechanic'){
      $('#taianapply-dues_proportion').parents('.yx-clear').hide();
    }
JS;
$this->registerJS($js);
?>
